package com.example.myprojectoffeixue;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;

public class SelectActivity extends Activity {
    ListView all_shebei;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_select);
        info();

    }


    public void info() {
        int[] ImageIDs = new int[]{R.drawable.tupian, R.drawable.tupia_chumokaig, R.drawable.tupian_mensuo, R.drawable.tupian_menci, R.drawable.tupian_zfq, R.drawable.tupian_hwrtgy, R.drawable.tupian_wkq, R.drawable.tupian_chuangl, R.drawable.tupian_chazuo};
        String[] nameStr = new String[]{"智能取电开关", "智能触摸开关", "门锁", "门磁", "红外转发器", "红外人体感应", "中央空调温控器", "窗帘", "智能插座"};
        all_shebei = (ListView) findViewById(R.id.all_shebei);
        LinearLayout iv3 = (LinearLayout) findViewById(R.id.iv_mykaiguan);
        iv3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        SelectAdapter sa = new SelectAdapter(ImageIDs, this, nameStr);
        all_shebei.setAdapter(sa);

        all_shebei.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                Intent it = new Intent(SelectActivity.this, IntreduceActivity.class);
                it.putExtra("flag", position);
                startActivity(it);
            }
        });

    }


}
